refactor: improve API design, CI enforcement, and test coverage#41
refactor: improve API design, CI enforcement, and test coverage#41
Conversation
- Add #[non_exhaustive] to Error enum and Config struct for semver safety - Make Config fields private with const getter methods (builder encapsulation) - Fix SLSA binary name: rust-template → rust_template in pipeline.yml - Raise coverage gate: 80% → 90% threshold with hard exit 1 failure - Fix Dockerfile HEALTHCHECK: remove ignored --version argument - Add process(input: &str) -> Result<i64> eliminating OperationFailed dead code - Add add_is_associative property test (completing algebraic coverage) - Add parameterized tests, trait tests, and binary unit tests (+22 tests) - Document i32→i64 widening strategy and process_numbers helper purpose - Coverage: 79.78% → 97.76% lines, 86.67% → 100% functions Clean Code: 8/10 | Architecture: 8/10 | Security Posture: 7/10
Benchmark ResultsNo benchmarks configured. Add benchmarks to benches/ directory. Full results available in CI artifacts. |
Mutation Testing ReportMutation testing output not found |
There was a problem hiding this comment.
Pull request overview
Refactors the public Rust API for better semver safety and encapsulation, tightens CI enforcement (coverage + SLSA artifact naming), and expands the test suite to significantly raise coverage.
Changes:
- Marked
ErrorandConfigas#[non_exhaustive], encapsulatedConfigfields, and addedconstgetters. - Added a new
process(&str) -> Result<i64>API and updated call sites/docs to useConfiggetters. - Hardened CI: fixed SLSA binary path, enforced a 90% coverage gate, and adjusted Docker HEALTHCHECK behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
crates/lib.rs |
Adds process(), marks public types #[non_exhaustive], and encapsulates Config with getters. |
crates/main.rs |
Updates binary to use Config getters and adds basic unit tests for run()/main(). |
tests/integration_test.rs |
Updates tests for encapsulated Config + adds property/parameterized/trait tests. |
README.md |
Updates example output formatting and switches to Config getters. |
Dockerfile |
Adjusts HEALTHCHECK invocation for the packaged binary. |
.github/workflows/pipeline.yml |
Fixes SLSA hashing input to use target/release/rust_template. |
.github/workflows/ci-coverage.yml |
Raises coverage threshold to 90% and fails CI when unmet. |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Mutation Testing ReportMutation testing output not found |
Benchmark ResultsNo benchmarks configured. Add benchmarks to benches/ directory. Full results available in CI artifacts. |
1 similar comment
Benchmark ResultsNo benchmarks configured. Add benchmarks to benches/ directory. Full results available in CI artifacts. |
Mutation Testing ReportMutation testing output not found |
Summary
ErrorandConfigfor semver safetypub const fngettersrust-template→rust_templatein pipeline.ymlexit 1--versionargprocess()function: givesOperationFailedreal usage, eliminates dead codeQuality Scores
Test plan
just checkpasses (fmt + clippy + test + doc + deny)Related: #40